<?php
ob_start();

require("public/class.phpmailer.php");

$mail = new PHPMailer();
$mail->IsSMTP();					// 启用SMTP

//$mail->Host = "61.136.58.211";			//SMTP服务器
//$mail->SMTPAuth = true;					//开启SMTP认证
//$mail->Username = "fengtop@fengtop.net";			// SMTP用户名
//$mail->Password = "123456789";				// SMTP密码
$mail->Host = "smtp.163.com";			//SMTP服务器
$mail->SMTPAuth = true;					//开启SMTP认证
$mail->Username = "fengtop@163.com";			// SMTP用户名
$mail->Password = "84a09s26d";				// SMTP密码

$mail->From = "fengtop@163.com";			//发件人地址

$mail->FromName = "Mailer";				//发件人
$mail->AddAddress("305412221@qq.com", "feng");	//添加收件人
//$mail->AddAddress("fengtop@hotmail.com");
//$mail->AddReplyTo("fengtop@163.com", "Information");	//回复地址
$mail->WordWrap = 50;					//设置每行字符长度
/** 附件设置
$mail->AddAttachment("/var/tmp/file.tar.gz");		// 添加附件
$mail->AddAttachment("/tmp/image.jpg", "new.jpg");	// 添加附件,并指定名称
*/
$mail->IsHTML(true);					// 是否HTML格式邮件
$mail->CharSet = "utf-8";				// 这里指定字符集！
$mail->Encoding = "base64"; 


$mail->Subject = "Here is the subject";			//邮件主题
$mail->Body    = "This is the HTML message body <b>in bold!</b>";		//邮件内容
$mail->AltBody = "This is the body in plain text for non-HTML mail clients";	//邮件正文不支持HTML的备用显示

if(!$mail->Send())
{
    echo '<html><head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head>
<body>含中文的内容';
    echo "消息未能正确发送. <p>";
    echo "发送方错误信息: " . $mail->ErrorInfo;
    echo '</body> </html> ';
    exit;
}

echo "Message has been sent";

ob_end_flush();
?>
